#include "spl.includes.h"
#include "splib.h"

using namespace SPLib;
using namespace SPLib::Controls;
using namespace SPLib::Geom;
using namespace Gdip;

#define     COLOR_DARK      0x88000000
#define     COLOR_LIGHT     0x88FFFFFF

VOID    Separator::onControlPaint(Controls::ControlPaintEvent& iEvent)
{
    INT offset;

    iEvent.graphics.SetSmoothingMode(Gdip::SmoothingModeNone);

    switch (orientation)
    {
    case OrientationHorizontal:
        offset = (iEvent.bounds.Height - 2) / 2;

        iEvent.graphics.FillRectangle(&SolidBrush(COLOR_DARK),
            0, offset, iEvent.bounds.Width, 1);
        iEvent.graphics.FillRectangle(&SolidBrush(COLOR_LIGHT),
            0, offset + 1, iEvent.bounds.Width, 1);
        break;
    case OrientationVertical:
        offset = (iEvent.bounds.Width - 2) / 2;

        iEvent.graphics.FillRectangle(&SolidBrush(COLOR_DARK),
            offset, 0, 1, iEvent.bounds.Height);
        iEvent.graphics.FillRectangle(&SolidBrush(COLOR_LIGHT),
            offset + 1, 0, 1, iEvent.bounds.Height);
        break;
    }
}
